<script th:inline="javascript">
    var myChart = null;
    $(document).ready(function () {
        var other = JSON.parse([[${footPerson.other}]]);
        $.each(other, function (name, value) {
            $("#other").append(name + ":" + value);
            $("#other").append("<br/>")
        });

        $('.tab-pane').slimScroll({//设置模块出现滚动条
            height: '150px'
        });

        var jrwza = eval("(" + [[${footPerson.position}]] + ")");
        $.each(jrwza, function (name, value) {
            if (name === "1") {
                $(value).each(function (i, n) {
                    getClass(n, 'B');
                });
            } else if (name === "2") {
                $(value).each(function (i, n) {
                    getClass(n, 'A');
                });
            }
            getClass([[${footPerson.wzbm}]], 'C');

            if (name === "1" || name === "2") {
                $(value).each(function (i, n) {
                    $("#ksywz").after("<div class='span6'><span class='label label-large " + "label-inverse arrowed-right'>可适应位置</span><span>" + n + "</span></div>");
                });

            }
        });

        require(
            ['echarts', 'echarts/chart/radar'],
            function (ec) {
                myChart = ec.init(document.getElementById('main'));
                myChart.showLoading({
                    text: '正在努力的读取数据中...'    //loading话术
                });
                myChart.hideLoading();
                var option = {
                    title: {
                        text: [[${null == footPerson.yw ? footPerson.name : footPerson.yw}]],
                        subtext: '球员数据',
                        textStyle: {
                            fontSize: 18,
                            fontWeight: 'bolder',
                            color: '#ccc'
                        }
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    toolbox: {
                        show: false,
                        feature: {
                            mark: {show: true},
                            dataView: {show: true, readOnly: false},
                            restore: {show: true},
                            saveAsImage: {show: true}
                        }
                    },
                    calculable: true,
                    polar: [{
                        indicator: [
                            {text: [[${head.nl20}]], max: 100},
                            {text: [[${head.nl33}]], max: 100},
                            {text: [[${head.nl25}]], max: 100},
                            {text: [[${head.nl23}]], max: 100},
                            {text: [[${head.nl22}]], max: 100},
                            {text: [[${head.nl32}]], max: 100}
                        ],
                        name: {textStyle: {color: '#ccc'}},
                        radius: 85
                    }],
                    series: [{
                        name: '球员数据',
                        type: 'radar',
                        itemStyle: {
                            normal: {areaStyle: {type: 'default'}}
                        },
                        data: [{
                            value: [
                                [[${footPerson.skillList[1].number}]],
                                [[${footPerson.skillList[14].number}]],
                                [[${footPerson.skillList[6].number}]],
                                [[${footPerson.skillList[4].number}]],
                                [[${footPerson.skillList[3].number}]],
                                [[${footPerson.skillList[13].number}]]],
                            name: [[${null == footPerson.yw ? footPerson.name : footPerson.yw}]]
                        }]
                    }]
                };
                myChart.setOption(option);
            });
    });

    function getClass(wz, issl) {
        if (wz === 'GK') $("#GK").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'SW') $("#SW").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'CB') $("#CB").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'LB') $("#LB").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'RB') $("#RB").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'DMF') $("#DMF").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'CMF') $("#CMF").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'LMF') $("#LMF").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'RMF') $("#RMF").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'LWF') $("#LWF").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'RWF') $("#RWF").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'AMF') $("#AMF").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'SS') $("#SS").attr("class", "icon-circle icon-1x position_" + issl);
        if (wz === 'CF') $("#CF").attr("class", "icon-circle icon-1x position_" + issl);
    }

    function updatePerson() {
        var ssjlb = $("#ssjlb").val();
        var sr = $("#sr").val();
        var hm = $("#hm").val();
        var grjj = $("#grjj").val();
        var zyjx = $("#zyjx").val();
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/hy/footPerson/edit",
            data: "id=" + [[${footPerson.id}]] + "&ssjlb=" + ssjlb +
            "&sr=" + sr + "&hm=" + hm + "&grjj=" + grjj + "&zyjx=" + zyjx,
            success: function (data) {
                if (data.msg === 'ok') {
                    window.location.reload();
                } else {
                    showTip('tip', '无法更改球员信息', 4000);
                }
            }
        });
    }
</script>